

class CoinTableViewModel {
  List<SessionModel> sessionModels = [];

  CoinTableViewModel.fromJson(List json) {
    json.forEach((element) {
        sessionModels.add(SessionModel.fromJson(element));
    });
  }
}

class SessionModel {
  SessionHeaderModel sessionHeaderModel;
  List<CellModel> cellModels = [];

  SessionModel.fromJson(Map<String, dynamic> json) {
    sessionHeaderModel = SessionHeaderModel.fromJson(json['header']);
    List<dynamic> cells = json['coins'];
    cells.forEach((element) {
      cellModels.add(CellModel.fromJson(element));
    });
  }
}

class SessionHeaderModel {
  String title;

  SessionHeaderModel.fromJson(Map<String, dynamic> json) {
    title = json['title'];
  }

  Map<String, dynamic> toJson() {
    return {'title': title};
  }
}

class CellModel {
  int fId;
  int img;
  String title;
  String coinid;
  String subTitle;
  String desc;
  String keep;
  String cnyBalance;
  String usdBalance;
  String num;
  String address;
  String contract;
  String cnyMoney;
  String usdMoney;
  String frozeAmount;
  int percent;
  bool isFocus;
  int major;
  int minor;
  int chainId;
  int precision;
  bool isSelected = false;

  CellModel(
          {this.fId,
            this.img,
            this.title,
            this.coinid,
            this.subTitle,
            this.desc,
            this.keep,
            this.cnyBalance,
            this.usdBalance,
            this.num,
            this.address,
            this.contract,
            this.cnyMoney,
            this.usdMoney,
            this.frozeAmount,
            this.percent,
            this.isFocus,
            this.major,
            this.minor,
            this.chainId,
            this.precision});

  CellModel.fromJson(Map<String, dynamic> json) {
    fId = json['f_id'];
    img = json['img'];
    title = json['title'];
    coinid = json['coinid'];
    subTitle = json['sub_title'];
    desc = json['desc'];
    keep = json['keep'];
    cnyBalance = json['cny_balance'];
    usdBalance = json['usd_balance'];
    num = json['num'];
    address = json['address'];
    contract = json['contract'];
    cnyMoney = json['cny_money'];
    usdMoney = json['usd_money'];
    frozeAmount = json['froze_amount'];
    percent = json['percent'];
    isFocus = json['is_focus'];
    major = json['major'];
    minor = json['minor'];
    chainId = json['chainId'];
    precision = json['precision'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['f_id'] = this.fId;
    data['img'] = this.img;
    data['title'] = this.title;
    data['coinid'] = this.coinid;
    data['sub_title'] = this.subTitle;
    data['desc'] = this.desc;
    data['keep'] = this.keep;
    data['cny_balance'] = this.cnyBalance;
    data['usd_balance'] = this.usdBalance;
    data['num'] = this.num;
    data['address'] = this.address;
    data['contract'] = this.contract;
    data['cny_money'] = this.cnyMoney;
    data['usd_money'] = this.usdMoney;
    data['froze_amount'] = this.frozeAmount;
    data['percent'] = this.percent;
    data['is_focus'] = this.isFocus;
    data['major'] = this.major;
    data['minor'] = this.minor;
    data['chainId'] = this.chainId;
    data['precision'] = this.precision;
    return data;
  }


//  CellModel({this.imgUrl, this.title, this.description, this.isSelected});
//
//  CellModel.fromJson(Map<String, dynamic> json) {
//    imgUrl = json['imgUrl'] ?? '';
//    title = json['title'];
//    description = json['description'];
//    isSelected = json['isSelected'];
//  }
//
//  Map<String, dynamic> toJson() {
//    return {'title': title, 'imgUrl': imgUrl, 'description': description,'isSelected':isSelected};
//  }
}
